package com.coocaa.ops.admin.v1.timedtask.convert;


import com.coocaa.ops.admin.v1.timedtask.constant.CronConstants;
import com.coocaa.ops.admin.v1.timedtask.constant.TimedTaskTypeConstants;
import com.coocaa.ops.common.core.base.enums.ResourceStatusEnums;
import com.coocaa.ops.common.core.biz.timedtask.entity.TimedTaskInfoEntity;

import java.util.Date;

/**
 * @author bijiahao
 * @date : 2019/8/6.
 * @description 定时相关的保存 转化器
 *
 */
public final class TimedTaskSaveConverter {

    public static TimedTaskInfoEntity getTimedTaskInfoEntityForTimelyShelves(Integer resourceId, String resourceType, Integer resourceVersion, Integer status, Integer currentOperator, Date createTime, Date releaseTime) {
        TimedTaskInfoEntity entity = new TimedTaskInfoEntity(resourceId, resourceType, resourceVersion, status, currentOperator, createTime, releaseTime);
        entity.setTimedType(TimedTaskTypeConstants.TIMELY_SHELVING);
        return entity;
    }

    public static TimedTaskInfoEntity getTimedTaskInfoEntityForRecommendPoolUpdate(Integer resourceId, String resourceType, Integer resourceVersion, Integer currentOperator) {
        TimedTaskInfoEntity entity = new TimedTaskInfoEntity(resourceId, resourceType, resourceVersion, ResourceStatusEnums.ON_LINE.getStatus(), currentOperator, new Date(), null);
        entity.setTimedType(TimedTaskTypeConstants.RECOMMEND_POOL_UPDATE);
        entity.setCron(CronConstants.EVERY_DAY);
        return entity;
    }
}
